package com.sky.config;


import com.sky.properties.MinioProperties;
import io.minio.MinioClient;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/*
 *
 * 配置类，用于MiniIoUtil对象的创建
 * */
@Data
@Configuration
@Slf4j
public class MinioConfiguration {

    @Autowired
    private MinioProperties prop;

    /**
     * 获取 MinioClient
     * @return MinioClient
     */
    @Bean
    public MinioClient minioClient() {
        log.info("创建minion对象");
        return MinioClient.builder().endpoint(prop.getEndpoint()).
                credentials(prop.getAccessKey(),prop.getSecretKwy()).build();
    }

}
